import time

from selenium.webdriver.common.by import By
from yuekao.Base.Base import Base
class Page1(Base):
    # 搜索框
    search_loc=(By.XPATH,'//*[@id="chat-textarea"]')
    # 点击搜索
    searchbtn_loc=(By.ID,'chat-submit-button')

    # 抓取第一页搜索的所有网站的标题，
    gjz_loc=(By.XPATH,'//*[@id="3001"]/div/div/div/div[1]/h3/div/a/font[2]')


    def search(self):
        self.send_keys(self.search_loc,'我喜欢软件测试')

    def searchbtn(self):
        self.click(self.searchbtn_loc)

    def gjz(self):
        self.click(self.gjz_loc)


    def luoji2(self):
        self.open_url('https://www.baidu.com')
        self.search()
        self.searchbtn()
        print(self.gjz())
        assert '我喜欢软件测试' == self.gjz_loc

